<?php 
$show_validator = true;
include TMPL_PATH.'public/header.phtml';
?>
<script type="text/javascript" src="/statics/xheditor/xheditor-zh-cn.min.js"></script>
<script type="text/javascript">
<!--
	$(function(){
		SwapTab('setting','on','',4,<?php echo (isset($_GET['tab']) && $_GET['tab']) ? $_GET['tab'] : '1'?>);
	})
//-->
</script>
<form action="__SELF__" method="post" id="myform">
<div class="pad-10">
<div class="col-tab">
<ul class="tabBut cu-li">
            <li id="tab_setting_1" class="on" onclick="SwapTab('setting','on','',4,1);">基本配置</li>
            <li id="tab_setting_2" onclick="SwapTab('setting','on','',4,2);">联系方式</li>
            <li id="tab_setting_3" onclick="SwapTab('setting','on','',4,3);">邮箱配置</li>
            <li id="tab_setting_4" onclick="SwapTab('setting','on','',4,4);">验证码置</li>
</ul>
<div id="div_setting_1" class="contentList pad-10">
<table width="100%"  class="table_form">
 <!-- 
<tr>
    <th width="120">主站URL</th>
    <td class="y-bg"><input type="text" class="input-text" name="cluster_master_site" id="cluster_master_site" size="50" value="<?php echo isset($config['cluster_master_site']) ? $config['cluster_master_site'] :null?>"/><div class="infoShow">数据同步到主站的URL域名,如：http://www.domain.com</div></td>
  </tr>
  <tr>
    <th width="120">子站ApiKey</th>
    <td class="y-bg"><input type="text" class="input-text" name="cluster_apikey" id="cluster_apikey" size="50" value="<?php echo isset($config['cluster_apikey']) ? $config['cluster_apikey'] :null?>"/><div class="infoShow">子站同步ApiKey，如要同步请先在主站后台注册</div></td>
  </tr> 
 -->
	<tr>
    <th width="120">网站默认语言</th>
    <td class="y-bg">
    <?php if(isset($languageList) && $languageList):?>
		<select name="language_id">
			<?php 
			foreach ($languageList as $language_id => $language_name):
				if(!is_numeric($language_id)) continue;
			?>
			<option value="<?php echo $language_id;?>" <?php if(isset($config['language_id'])&& $config['language_id']==$language_id) echo 'selected';?>><?php echo $language_name;?></option>
			<?php endforeach;?>
		</select>
		<?php else:?>
		<input name="language_id" value="1" type="hidden" />
		<?php if(C('DEFAULT_LANG')=='en-us')echo '英文';else echo '中文';?>
		<?php endif;?>
    </td>
  </tr>
  <tr>
    <th width="120">网站模板</th>
    <td class="y-bg">
    <?php if(isset($themsList) && $themsList):?>
		<select name="DEFAULT_THEME">
			<?php 
			foreach ($themsList as $tpl):
			?>
			<option value="<?php echo $tpl;?>" <?php if(isset($config['DEFAULT_THEME'])&& $config['DEFAULT_THEME']==$tpl) echo 'selected';?>><?php echo $tpl;?></option>
			<?php endforeach;?>
		</select>
		<?php else:?>
		<input name="DEFAULT_THEME" value="default" type="hidden" />默认模板
		<?php endif;?>
    </td>
  </tr>
  <tr>
    <th width="120">网站名称</th>
    <td class="y-bg"><input type="text" class="input-text" name="site_name" id="site_name" size="50" value="<?php echo isset($config['site_name']) ? $config['site_name'] :null?>"/></td>
  </tr>
  <tr>
    <th width="120">网站域名</th>
    <td class="y-bg"><input type="text" class="input-text" name="site_url" id="site_url" size="50" value="<?php echo isset($config['site_url']) ? $config['site_url'] :null?>"/></td>
  </tr>
  <tr>
    <th width="120">网站备案</th>
    <td class="y-bg"><input type="text" class="input-text" name="record" id="record" size="50" value="<?php echo isset($config['record']) ? $config['record'] :null?>"/></td>	
  <tr>
    <th width="120">管理员邮箱</th>
    <td class="y-bg"><input type="text" class="input-text" name="site_email" id="site_email" size="50" value="<?php echo isset($config['site_email']) && $config['site_email'] ? $config['site_email'] : null?>" /></td>
  </tr>
   <tr>
    <th width="120">首页搜索的关键字</th>
    <td class="y-bg"><input type="text" class="input-text" id="index_search" style="width:500px;" name="index_search" value="<?php echo isset($config['index_search']) ? stripslashes($config['index_search']) :null?>"/><div class="infoShow">首页显示的搜索关键字,请用半角逗号(,)分隔多个关键字</div></td>
  </tr>
  <tr>
    <th width="120">首页网页标题</th>
    <td class="y-bg"><input type="text" class="input-text" name="meta_title" id="meta_title" style="width:500px;" value="<?php echo isset($config['meta_title']) ? $config['meta_title'] :null?>"/></td>	
  <tr>
    <th width="120">首页网页关键字</th>
    <td class="y-bg"><textarea style="height:50px;width:500px;" class="inputtext" id="meta_keywords" cols="20" rows="2" name="meta_keywords"><?php echo isset($config['meta_keywords']) ? stripslashes($config['meta_keywords']) :null?></textarea></td>
  </tr>
  <tr>
    <th width="120">首页网页描述</th>
    <td class="y-bg"><textarea style="height:50px;width:500px;" class="inputtext" id="meta_description" cols="20" rows="2" name="meta_description"><?php echo isset($config['meta_description']) ? stripslashes($config['meta_description']) :null?></textarea></td>
  </tr>
  <tr>
    <th width="120">版权信息</th>
    <td><textarea style="height:100px;width:80%;" class="editor" id="copyright" name="copyright"><?php echo isset($config['copyright']) ? stripslashes($config['copyright']) :null?></textarea></td>
  </tr> 
   <tr>
    <th width="120">屏蔽访问国家</th>
    <td class="y-bg"><input type="text" class="input-text" name="barred_list" size="50" value="<?php echo isset($config['barred_list']) && $config['barred_list'] ? $config['barred_list'] : null?>" /> 国家名称双字母简写大写，多个国家请用半角逗号(,)分隔</td>
  </tr>
  <tr>
    <th width="120">屏蔽国家访问密码</th>
    <td class="y-bg"><input type="text" class="input-text" name="barred_access_password" size="50" value="<?php echo isset($config['barred_access_password']) && $config['barred_access_password'] ? $config['barred_access_password'] : null?>" /></td>
  </tr>
</table>
</div>
<div id="div_setting_2" class="contentList pad-10">
<table width="100%"  class="table_form">
  <tr>
    <th width="120">联系人</th>
    <td class="y-bg"><input type="text" class="input-text" name="contact_name" id="contact_name" value="<?php echo isset($config['contact_name']) ? $config['contact_name'] :null?>"/></td>
  </tr>
  <tr>
    <th width="120">联系电话</th>
    <td class="y-bg"><input type="text" class="input-text" name="contact_phone" id="contact_phone" value="<?php echo isset($config['contact_phone']) ? $config['contact_phone'] :null?>"/></td>
  </tr>
  <tr>
    <th width="120">联系地址</th>
    <td class="y-bg"><input type="text" class="input-text" name="contact_address" id="contact_address" size="50" value="<?php echo isset($config['contact_address']) ? $config['contact_address'] :null?>"/></td>	
  <tr>
    <th width="120">公司名称</th>
    <td class="y-bg"><input type="text" class="input-text" name="contact_company" id="contact_company" size="50" value="<?php echo isset($config['contact_company']) && $config['contact_company'] ? $config['contact_company'] : null?>" /></td>
  </tr>
</table>
</div>
<div id="div_setting_3" class="contentList pad-10 hidden">
<table width="100%"  class="table_form">
  <tr>
    <th width="120">邮件发送模式</th>
    <td class="y-bg">
     <input name="mail_type"  value="1" onclick="showsmtp(this)" type="radio"  <?php echo $config['mail_type']==1 ? ' checked' : ''?>> SMTP 函数发送    
     <input name="mail_type" value="0" onclick="showsmtp(this)" type="radio"  <?php echo $config['mail_type']==0 ? ' checked' : ''?> <?php if(substr(strtolower(PHP_OS), 0, 3) == 'win') echo 'disabled'; ?>/> mail 模块发送 
	</td>
  </tr>
  <tbody id="smtpcfg" style="<?php if($config['mail_type'] == 0) echo 'display:none'?>">
  <tr>
    <th>邮件服务器</th>
    <td class="y-bg"><input type="text" class="input-text" name="mail_server" id="mail_server" size="30" value="<?php echo $config['mail_server'];?>"/><div class="infoShow">第三方的SMTP的URL地址</div></td>
  </tr>  
  <tr>
    <th>邮件发送端口</th>
    <td class="y-bg"><input type="text" class="input-text" name="mail_port" id="mail_port" size="30" value="<?php echo $config['mail_port'];?>"/><div class="infoShow">SMTP端口号(默认：25)，Gmail 端口为465</div></td>
  </tr> 
  <tr>
    <th>发件人地址</th>
    <td class="y-bg"><input type="text" class="input-text" name="mail_from" id="mail_from" size="30" value="<?php echo $config['mail_from'];?>"/><div class="infoShow">发送邮件所使用的email地址，邮件内容中的收件人信息就是显示此信息</div></td>
  </tr>
  <tr>
    <th>SSL验证</th>
    <td class="y-bg">
    <input name="mail_ssl"  value="0" type="radio" <?php echo (!isset($config['mail_ssl']) || $config['mail_ssl']==0) ? ' checked' : ''?>> 关闭 
    <input name="mail_ssl" value="1" type="radio"  <?php echo $config['mail_ssl']==1 ? ' checked' : ''?>> 开启	 <div class="infoShow">Gmail 必须开启</div>
    </td>
  </tr>

	  <tr>
	    <th>验证用户名</th>
	    <td class="y-bg"><input type="text" class="input-text" name="mail_user" id="mail_user" size="30" value="<?php echo $config['mail_user'];?>"/><div class="infoShow">SMTP用户名</div></td>
	  </tr> 
	  <tr>
	    <th>验证密码</th>
	    <td class="y-bg"><input type="password" class="input-text" name="mail_password" id="mail_password" size="30" value="<?php echo $config['mail_password'];?>"/><div class="infoShow">SMTP密码</div></td>
	  </tr>

 </tbody>
  <tr>
    <th>邮件设置测试</th>
    <td class="y-bg"><input type="text" class="input-text" name="mail_to" id="mail_to" size="30" value=""/> <input type="button" class="button" onClick="javascript:test_mail();" value="测试发送"></td>
  </tr>           
  </table>
</div>
<div id="div_setting_4" class="contentList pad-10">
<table width="100%"  class="table_form">
  <tr>
    <th width="120">登录验证码</th>
    <td class="y-bg"><input type="radio" name="vcode_login"  value="0" <?php echo !isset($config['vcode_login']) || (isset($config['vcode_login']) && $config['vcode_login']==0) ? 'checked' :null?>/> 不开启
    <input type="radio" name="vcode_login"  value="1" <?php echo isset($config['vcode_login']) && $config['vcode_login']==1 ? 'checked' :null?>/> 开启 
<!--    <input type="radio" name="vcode_login"  value="2" <?php echo isset($config['vcode_login']) && $config['vcode_login']==2 ? 'checked' :null?>/> 输入三次错误后开启-->
</td>
  </tr>
  <tr>
    <th width="120">注册验证码</th>
    <td class="y-bg"><input type="radio" name="vcode_register"  value="0" <?php echo !isset($config['vcode_register']) || (isset($config['vcode_register']) && $config['vcode_register']==0) ? 'checked' :null?>/> 不开启
    <input type="radio" name="vcode_register"  value="1" <?php echo isset($config['vcode_register']) && $config['vcode_register']==1 ? 'checked' :null?>/> 开启 
<!--    <input type="radio" name="vcode_register"  value="2" <?php echo isset($config['vcode_register']) && $config['vcode_register']==2 ? 'checked' :null?>/> 输入三次错误后开启-->
</td>
  </tr>
  <tr>
    <th width="120">找回密码验证码</th>
    <td class="y-bg"><input type="radio" name="vcode_password"  value="0" <?php echo !isset($config['vcode_password']) || (isset($config['vcode_password']) && $config['vcode_password']==0) ? 'checked' :null?>/> 不开启
    <input type="radio" name="vcode_password"  value="1" <?php echo isset($config['vcode_password']) && $config['vcode_password']==1 ? 'checked' :null?>/> 开启 
<!--    <input type="radio" name="vcode_password"  value="2" <?php echo isset($config['vcode_password']) && $config['vcode_password']==2 ? 'checked' :null?>/> 输入三次错误后开启-->
    </td>
  </tr>
  <tr>
    <th width="120">订单查询验证码</th>
    <td class="y-bg"><input type="radio" name="vcode_order_query"  value="0" <?php echo !isset($config['vcode_order_query']) || (isset($config['vcode_order_query']) && $config['vcode_order_query']==0) ? 'checked' :null?>/> 不开启
    <input type="radio" name="vcode_order_query"  value="1" <?php echo isset($config['vcode_order_query']) && $config['vcode_order_query']==1 ? 'checked' :null?>/> 开启 
<!--    <input type="radio" name="vcode_order_query"  value="2" <?php echo isset($config['vcode_order_query']) && $config['vcode_order_query']==2 ? 'checked' :null?>/> 输入三次错误后开启-->
    </td>
  </tr>
</table>
</div>
<div class="bk15"></div>
<input name="dosubmit" type="submit" class="button" value="提交" class="button">
</div>
</div>
</form>
</body>
<script type="text/javascript">
function showsmtp(obj,hiddenid){
	hiddenid = hiddenid ? hiddenid : 'smtpcfg';
	var status = $(obj).val();
	if(status == 1) $("#"+hiddenid).show();
	else  $("#"+hiddenid).hide();
}
function test_mail() {
	var mail_type = $('input[checkbox=mail_type][checked]').val();
	var mail_auth = $('input[checkbox=mail_auth][checked]').val();
    $.post('<?php echo U('site/public_test_mail');?>',{mail_to:$('#mail_to').val(),mail_type:mail_type,mail_server:$('#mail_server').val(),mail_port:$('#mail_port').val(),mail_user:$('#mail_user').val(),mail_password:$('#mail_password').val(),mail_auth:mail_auth,mail_from:$('#mail_from').val()}, function(data){
	alert(data);
	});
}

</script>
</html>